Check whether dom is NULL when we handle a watch. This might occur if the
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Wed, 26 Oct 2005 12:41:00 +0000 (13:41 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Wed, 26 Oct 2005 12:41:00 +0000 (13:41 +0100)
domain has recently been removed from our list, but with a watch still in
flight.  This should fix the intermittent crash in xenconsoled that is plaguing
us at the moment.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/console/daemon/io.c

index 0b55607d50998ddd44184427210d55aacb1ba648..ef3f094d27099058cc31f64d855bb6bd892245af 100644 (file)
@@ -512,7 +512,9 @@ static void handle_xs(int fd)
                enum_domains();
        else if (sscanf(vec[XS_WATCH_TOKEN], "dom%u", &domid) == 1) {
                dom = lookup_domain(domid);
-               if (dom->is_dead == false)
+               /* We may get watches firing for domains that have recently
+                  been removed, so dom may be NULL here. */
+               if (dom && dom->is_dead == false)
                        domain_create_ring(dom);
        }